package sv.gob.mh.dgii.model;

// Generated Dec 12, 2007 1:25:05 PM by Hibernate Tools 3.2.0.CR1

import java.util.Date;
import java.util.HashSet;
import java.util.Set;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

/**
 * CdDocumento generated by hbm2java
 */
@Entity
@Table(name = "CD_DOCUMENTO", schema = "CTROLDOC")
public class CdDocumento implements java.io.Serializable {

	/**
	 * 
	 */
	private static final long serialVersionUID = -4838631218684136089L;
	private String ndocumento;
	private RcRuc rcRuc;
	private RcRuc rcRucTecnico;
	private TbTipoTramite tbTipoTramite;
	private TbUnidad tbUnidad;
	private TbImpuesto tbImpuesto;
	private CdTipoDocum cdTipoDocum;
	private TbAdmTrib tbAdmTrib;
	private Date fhcreacionDoc;
	private Date fhcierreDoc;
	private String ndocumAgrega;
	private String cobligacion;
	private String ninventario;
	private String dnumReferen;
	private String cusuario;
	private Long nsecuencial;
	private Long nultEnvio;
	private Integer bimpreso;
	private Long ncantFolio;
	private Integer npieza;
	private String s1aperasoc;
	private String s2apeabrev;
	private String snombres;
	private String cestado;
	private String nresolucion;
	private String nresoln2;
	private String nresoln3;
	private String nresoln4;
	private String nresoln5;
	private Long nfolioInicial;
	private Long nfolioFinal;
	private Set<CdNotas> cdNotases = new HashSet<CdNotas>(0);
	private Set<DfDictamen> dfDictamens = new HashSet<DfDictamen>(0);
	private Set<CgCaso> cgCasos = new HashSet<CgCaso>(0);
	private Set<CdUbicacArch> cdUbicacArchs = new HashSet<CdUbicacArch>(0);
	private Set<CdHistMov> cdHistMovs = new HashSet<CdHistMov>(0);
	private Set<CdDocumEnvio> cdDocumEnvios = new HashSet<CdDocumEnvio>(0);
	private Set<CdPiezaDocum> cdPiezaDocums = new HashSet<CdPiezaDocum>(0);
	private Set<ImSolicitud> imSolicituds = new HashSet<ImSolicitud>(0);

	public CdDocumento() {
	}

	public CdDocumento(String ndocumento, TbUnidad tbUnidad,
			CdTipoDocum cdTipoDocum, Date fhcreacionDoc, String cobligacion,
			String cusuario, Long nsecuencial, Integer bimpreso, 
			Long ncantFolio, Long nfolioInicial, Long nfolioFinal, String s1aperasoc,String s2apeabrev,String snombres) {
		this.ndocumento = ndocumento;
		this.tbUnidad = tbUnidad;
		this.cdTipoDocum = cdTipoDocum;
		this.fhcreacionDoc = fhcreacionDoc;
		this.cobligacion = cobligacion;
		this.cusuario = cusuario;
		this.nsecuencial = nsecuencial;
		this.bimpreso = bimpreso;
		this.ncantFolio = ncantFolio;
		this.nfolioInicial = nfolioInicial;		
		this.nfolioFinal = nfolioFinal;		
	
	}

	public CdDocumento(String ndocumento, RcRuc rcRuc,
			TbTipoTramite tbTipoTramite, TbUnidad tbUnidad,
			TbImpuesto tbImpuesto, CdTipoDocum cdTipoDocum,
			TbAdmTrib tbAdmTrib, Date fhcreacionDoc, Date fhcierreDoc,
			String ndocumAgrega, String cobligacion, String ninventario,
			String dnumReferen, String cusuario, Long nsecuencial,
			Long nultEnvio, Integer bimpreso, Long ncantFolio, 
			Long nfolioInicial, Long nfolioFinal, Integer npieza,
			String s1aperasoc,String s2apeabrev,String snombres,
			Set<CdNotas> cdNotases, Set<DfDictamen> dfDictamens,
			Set<CgCaso> cgCasos, Set<CdUbicacArch> cdUbicacArchs,
			Set<CdHistMov> cdHistMovs, Set<CdDocumEnvio> cdDocumEnvios,
			Set<CdPiezaDocum> cdPiezaDocums, Set<ImSolicitud> imSolicituds) {
		this.ndocumento = ndocumento;
		this.rcRuc = rcRuc;
		this.tbTipoTramite = tbTipoTramite;
		this.tbUnidad = tbUnidad;
		this.tbImpuesto = tbImpuesto;
		this.cdTipoDocum = cdTipoDocum;
		this.tbAdmTrib = tbAdmTrib;
		this.fhcreacionDoc = fhcreacionDoc;
		this.fhcierreDoc = fhcierreDoc;
		this.ndocumAgrega = ndocumAgrega;
		this.cobligacion = cobligacion;
		this.ninventario = ninventario;
		this.dnumReferen = dnumReferen;
		this.cusuario = cusuario;
		this.nsecuencial = nsecuencial;
		this.nultEnvio = nultEnvio;
		this.bimpreso = bimpreso;
		this.ncantFolio = ncantFolio;
		this.nfolioInicial = nfolioInicial;	
		this.nfolioFinal = nfolioFinal;	
		this.npieza = npieza;
		this.s1aperasoc=s1aperasoc;
		this.s2apeabrev=s2apeabrev;
		this.snombres=snombres;
		this.cdNotases = cdNotases;
		this.dfDictamens = dfDictamens;
		this.cgCasos = cgCasos;
		this.cdUbicacArchs = cdUbicacArchs;
		this.cdHistMovs = cdHistMovs;
		this.cdDocumEnvios = cdDocumEnvios;
		this.cdPiezaDocums = cdPiezaDocums;
		this.imSolicituds = imSolicituds;
	}

	@Id
	@Column(name = "N_DOCUMENTO", unique = true, nullable = false, length = 12)
	public String getNdocumento() {
		return this.ndocumento;
	}

	public void setNdocumento(String ndocumento) {
		this.ndocumento = ndocumento;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "NIT")
	public RcRuc getRcRuc() {
		return this.rcRuc;
	}

	public void setRcRuc(RcRuc rcRuc) {
		this.rcRuc = rcRuc;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "C_TIPO_TRAMITE")
	public TbTipoTramite getTbTipoTramite() {
		return this.tbTipoTramite;
	}

	public void setTbTipoTramite(TbTipoTramite tbTipoTramite) {
		this.tbTipoTramite = tbTipoTramite;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "C_UNIDAD", nullable = false)
	public TbUnidad getTbUnidad() {
		return this.tbUnidad;
	}

	public void setTbUnidad(TbUnidad tbUnidad) {
		this.tbUnidad = tbUnidad;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "C_IMPUESTO")
	public TbImpuesto getTbImpuesto() {
		return this.tbImpuesto;
	}

	public void setTbImpuesto(TbImpuesto tbImpuesto) {
		this.tbImpuesto = tbImpuesto;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "C_TIPO_EXP", nullable = false)
	public CdTipoDocum getCdTipoDocum() {
		return this.cdTipoDocum;
	}

	public void setCdTipoDocum(CdTipoDocum cdTipoDocum) {
		this.cdTipoDocum = cdTipoDocum;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "C_ADM_TRIB")
	public TbAdmTrib getTbAdmTrib() {
		return this.tbAdmTrib;
	}

	public void setTbAdmTrib(TbAdmTrib tbAdmTrib) {
		this.tbAdmTrib = tbAdmTrib;
	}

	//@Temporal(TemporalType.DATE)
	@Temporal(TemporalType.TIMESTAMP)
	@Column(name = "FH_CREACION_DOC", nullable = false, length = 7)
	public Date getFhcreacionDoc() {
		return this.fhcreacionDoc;
	}

	public void setFhcreacionDoc(Date fhcreacionDoc) {
		this.fhcreacionDoc = fhcreacionDoc;
	}

	//@Temporal(TemporalType.DATE)
	@Temporal(TemporalType.TIMESTAMP)
	@Column(name = "FH_CIERRE_DOC", length = 7)
	public Date getFhcierreDoc() {
		return this.fhcierreDoc;
	}

	public void setFhcierreDoc(Date fhcierreDoc) {
		this.fhcierreDoc = fhcierreDoc;
	}

	@Column(name = "N_DOCUM_AGREGA", length = 12)
	public String getNdocumAgrega() {
		return this.ndocumAgrega;
	}

	public void setNdocumAgrega(String ndocumAgrega) {
		this.ndocumAgrega = ndocumAgrega;
	}

	@Column(name = "C_OBLIGACION", nullable = true, length = 2)
	public String getCobligacion() {
		return this.cobligacion;
	}

	public void setCobligacion(String cobligacion) {
		this.cobligacion = cobligacion;
	}

	@Column(name = "N_INVENTARIO", length = 10)
	public String getNinventario() {
		return this.ninventario;
	}

	public void setNinventario(String ninventario) {
		this.ninventario = ninventario;
	}

	@Column(name = "D_NUM_REFEREN", length = 20)
	public String getDnumReferen() {
		return this.dnumReferen;
	}

	public void setDnumReferen(String dnumReferen) {
		this.dnumReferen = dnumReferen;
	}

	@Column(name = "C_USUARIO", nullable = false, length = 30)
	public String getCusuario() {
		return this.cusuario;
	}

	public void setCusuario(String cusuario) {
		this.cusuario = cusuario;
	}

	@Column(name = "N_SECUENCIAL", nullable = false, precision = 10, scale = 0)
	public Long getNsecuencial() {
		return this.nsecuencial;
	}

	public void setNsecuencial(Long nsecuencial) {
		this.nsecuencial = nsecuencial;
	}

	@Column(name = "N_ULT_ENVIO", precision = 10, scale = 0)
	public Long getNultEnvio() {
		return this.nultEnvio;
	}

	public void setNultEnvio(Long nultEnvio) {
		this.nultEnvio = nultEnvio;
	}

	@Column(name = "B_IMPRESO", nullable = false, precision = 1, scale = 0)
	public Integer getBimpreso() {
		return this.bimpreso;
	}

	public void setBimpreso(Integer bimpreso) {
		this.bimpreso = bimpreso;
	}

	@Column(name = "N_CANT_FOLIO", nullable = false, precision = 10, scale = 0)
	public Long getNcantFolio() {
		return this.ncantFolio;
	}

	public void setNcantFolio(Long ncantFolio) {
		this.ncantFolio = ncantFolio;
	}
	
	@Column(name = "N_PIEZA", precision = 5, scale = 0)
	public Integer getNpieza() {
		return this.npieza;
	}

	public void setNpieza(Integer npieza) {
		this.npieza = npieza;
	}
	
	
	@Column(name = "S_1APE_RASOC", length = 100)
	public String getS1aperasoc() {
		return this.s1aperasoc;
	}

	public void setS1aperasoc(String s1aperasoc) {
		this.s1aperasoc = s1aperasoc;
	}
	
	@Column(name = "S_2APE_ABREV", length = 25)
	public String getS2apeabrev() {
		return this.s2apeabrev;
	}

	public void setS2apeabrev(String s2apeabrev) {
		this.s2apeabrev = s2apeabrev;
	}
	
	@Column(name = "S_NOMBRES", length = 40)
	public String getSnombres() {
		return this.snombres;
	}

	public void setSnombres(String snombres) {
		this.snombres = snombres;
	}
	
	
	@Column(name = "C_ESTADO", length = 1)
	public String getCestado() {
		return this.cestado;
	}

	public void setCestado(String cestado) {
		this.cestado = cestado;
	}

	@Column(name = "N_RESOLUCION", length = 15)
	public String getNresolucion() {
		return this.nresolucion;
	}

	public void setNresolucion(String nresolucion) {
		this.nresolucion = nresolucion;
	}
		
		
	@Column(name = "N_RESOL_N2", length = 15)
	public String getNresoln2() {
		return this.nresoln2;
	}
	public void setNresoln2(String nresoln2) {
		this.nresoln2 = nresoln2;
	}	

	@Column(name = "N_RESOL_N3", length = 15)
	public String getNresoln3() {
		return this.nresoln3;
	}
	public void setNresoln3(String nresoln3) {
		this.nresoln3 = nresoln3;
	}
	
	@Column(name = "N_RESOL_N4", length = 15)
	public String getNresoln4() {
		return this.nresoln4;
	}
	public void setNresoln4(String nresoln4) {
		this.nresoln4 = nresoln4;
	}

	@Column(name = "N_RESOL_N5", length = 15)
	public String getNresoln5() {
		return this.nresoln5;
	}
	public void setNresoln5(String nresoln5) {
		this.nresoln5 = nresoln5;
	}
	
	
	
	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "NIT_TECNICO",  nullable = true)
	public RcRuc getRcRucTecnico() {
		return this.rcRucTecnico;
	}

	public void setRcRucTecnico(RcRuc rcRucTecnico) {
		this.rcRucTecnico = rcRucTecnico;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "cdDocumento")
	public Set<CdNotas> getCdNotases() {
		return this.cdNotases;
	}

	public void setCdNotases(Set<CdNotas> cdNotases) {
		this.cdNotases = cdNotases;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "ndocumento")
	public Set<DfDictamen> getDfDictamens() {
		return this.dfDictamens;
	}

	public void setDfDictamens(Set<DfDictamen> dfDictamens) {
		this.dfDictamens = dfDictamens;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "cdDocumento")
	public Set<CgCaso> getCgCasos() {
		return this.cgCasos;
	}

	public void setCgCasos(Set<CgCaso> cgCasos) {
		this.cgCasos = cgCasos;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "cdDocumento")
	public Set<CdUbicacArch> getCdUbicacArchs() {
		return this.cdUbicacArchs;
	}

	public void setCdUbicacArchs(Set<CdUbicacArch> cdUbicacArchs) {
		this.cdUbicacArchs = cdUbicacArchs;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "cdDocumento")
	public Set<CdHistMov> getCdHistMovs() {
		return this.cdHistMovs;
	}

	public void setCdHistMovs(Set<CdHistMov> cdHistMovs) {
		this.cdHistMovs = cdHistMovs;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "cdDocumento")
	public Set<CdDocumEnvio> getCdDocumEnvios() {
		return this.cdDocumEnvios;
	}

	public void setCdDocumEnvios(Set<CdDocumEnvio> cdDocumEnvios) {
		this.cdDocumEnvios = cdDocumEnvios;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "cdDocumento")
	public Set<CdPiezaDocum> getCdPiezaDocums() {
		return this.cdPiezaDocums;
	}

	public void setCdPiezaDocums(Set<CdPiezaDocum> cdPiezaDocums) {
		this.cdPiezaDocums = cdPiezaDocums;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "cdDocumento")
	public Set<ImSolicitud> getImSolicituds() {
		return imSolicituds;
	}

	public void setImSolicituds(Set<ImSolicitud> imSolicituds) {
		this.imSolicituds = imSolicituds;
	}

	@Column(name = "N_FOLIO_INICIAL", nullable = false, precision = 10, scale = 0)
	public Long getNfolioInicial() {
		return this.nfolioInicial;
	}

	public void setNfolioInicial(Long nfolioInicial) {
		this.nfolioInicial = nfolioInicial;
	}
	
	@Column(name = "N_FOLIO_FINAL", nullable = false, precision = 10, scale = 0)
	public Long getNfolioFinal() {
		return this.nfolioFinal;
	}

	public void setNfolioFinal(Long nfolioFinal) {
		this.nfolioFinal = nfolioFinal;
	}
	
}
